<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>javascript 阶段</title>
    <style>
        body {
            font-size: 20px;
        }
    </style>
</head>
<body>

    <div class="">卧槽,你是2b吗?</div>
    <div>
       ---
    </div>
    <div class="message">卧槽,你是2b吗?</div>

    <script>
        // 替换 
        // replace(正则表达式,"**");

        // 定义正则表达式
        var regExp = /(卧槽)|(2b)/g;

        // 获取div标签
        var msg = document.querySelector(".message");

        // 重新赋值
        msg.innerHTML = msg.innerHTML.replace(regExp,"**");

        

    </script>
</body>
</html>